﻿<%@ Page Title="" Language="C#" MasterPageFile="~/ModulesPage.Master" AutoEventWireup="true" CodeBehind="StaffManagement.aspx.cs" Inherits="SwenAssignment3.HousekeepingManagementModule.StaffManagement" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <style type="text/css">
        .auto-style1
        {
            text-decoration: underline;
            color:white;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <p>
                <span class="auto-style1"><strong>Staff Management</strong></span>
            </p>
            <p>
                &nbsp;
            </p>
            <p>
                <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" BackColor="White" BorderColor="#DEDFDE" BorderStyle="None" BorderWidth="1px" CellPadding="4" DataKeyNames="StaffID" DataSourceID="SqlDataSource2" ForeColor="Black" GridLines="Vertical" Height="50px" Width="125px">
                    <AlternatingRowStyle BackColor="White" />
                    <EditRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" />
                    <Fields>
                        <asp:BoundField DataField="StaffID" HeaderText="StaffID" ReadOnly="True" SortExpression="StaffID" />
                        <asp:BoundField DataField="FirstName" HeaderText="FirstName" SortExpression="FirstName" />
                        <asp:BoundField DataField="LastName" HeaderText="LastName" SortExpression="LastName" />
                        <asp:BoundField DataField="DOB" HeaderText="DOB" SortExpression="DOB" />
                        <asp:BoundField DataField="HomeAddress" HeaderText="HomeAddress" SortExpression="HomeAddress" />
                        <asp:BoundField DataField="PhoneNo" HeaderText="PhoneNo" SortExpression="PhoneNo" />
                        <asp:BoundField DataField="BankAccNo" HeaderText="BankAccNo" SortExpression="BankAccNo" />
                        <asp:BoundField DataField="DutiesID" HeaderText="DutiesID" SortExpression="DutiesID" />
                        <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" ShowInsertButton="True" />
                    </Fields>
                    <FooterStyle BackColor="#CCCC99" />
                    <HeaderStyle BackColor="#6B696B" Font-Bold="True" ForeColor="White" />
                    <PagerStyle BackColor="#F7F7DE" ForeColor="Black" HorizontalAlign="Right" />
                    <RowStyle BackColor="#F7F7DE" />
                </asp:DetailsView>
                <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="Data Source=USER-MSI\MSSQLSERVER2012;Initial Catalog=DRHotelDB;User ID=sa;Password=imsa" DeleteCommand="DELETE FROM [StaffProfile] WHERE [StaffID] = @StaffID" InsertCommand="INSERT INTO [StaffProfile] ([StaffID], [FirstName], [LastName], [DOB], [HomeAddress], [PhoneNo], [BankAccNo], [DutiesID]) VALUES (@StaffID, @FirstName, @LastName, @DOB, @HomeAddress, @PhoneNo, @BankAccNo, @DutiesID)" ProviderName="System.Data.SqlClient" SelectCommand="SELECT * FROM [StaffProfile] WHERE ([StaffID] = @StaffID)" UpdateCommand="UPDATE [StaffProfile] SET [FirstName] = @FirstName, [LastName] = @LastName, [DOB] = @DOB, [HomeAddress] = @HomeAddress, [PhoneNo] = @PhoneNo, [BankAccNo] = @BankAccNo, [DutiesID] = @DutiesID WHERE [StaffID] = @StaffID">
                    <DeleteParameters>
                        <asp:Parameter Name="StaffID" Type="String" />
                    </DeleteParameters>
                    <InsertParameters>
                        <asp:Parameter Name="StaffID" Type="String" />
                        <asp:Parameter Name="FirstName" Type="String" />
                        <asp:Parameter Name="LastName" Type="String" />
                        <asp:Parameter DbType="Date" Name="DOB" />
                        <asp:Parameter Name="HomeAddress" Type="String" />
                        <asp:Parameter Name="PhoneNo" Type="Int32" />
                        <asp:Parameter Name="BankAccNo" Type="String" />
                        <asp:Parameter Name="DutiesID" Type="String" />
                    </InsertParameters>
                    <SelectParameters>
                        <asp:ControlParameter ControlID="GridView1" Name="StaffID" PropertyName="SelectedValue" Type="String" />
                    </SelectParameters>
                    <UpdateParameters>
                        <asp:Parameter Name="FirstName" Type="String" />
                        <asp:Parameter Name="LastName" Type="String" />
                        <asp:Parameter DbType="Date" Name="DOB" />
                        <asp:Parameter Name="HomeAddress" Type="String" />
                        <asp:Parameter Name="PhoneNo" Type="Int32" />
                        <asp:Parameter Name="BankAccNo" Type="String" />
                        <asp:Parameter Name="DutiesID" Type="String" />
                        <asp:Parameter Name="StaffID" Type="String" />
                    </UpdateParameters>
                </asp:SqlDataSource>
            </p>
            <p>
                &nbsp;
            </p>
            <p>
                <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="4" DataKeyNames="StaffID" DataSourceID="SqlDataSource1" ForeColor="#333333" GridLines="None">
                    <AlternatingRowStyle BackColor="White" />
                    <Columns>
                        <asp:CommandField ShowSelectButton="True" />
                        <asp:BoundField DataField="StaffID" HeaderText="StaffID" ReadOnly="True" SortExpression="StaffID" />
                        <asp:BoundField DataField="FirstName" HeaderText="FirstName" SortExpression="FirstName" />
                        <asp:BoundField DataField="LastName" HeaderText="LastName" SortExpression="LastName" />
                        <asp:BoundField DataField="DOB" HeaderText="DOB" SortExpression="DOB" />
                        <asp:BoundField DataField="HomeAddress" HeaderText="HomeAddress" SortExpression="HomeAddress" />
                        <asp:BoundField DataField="PhoneNo" HeaderText="PhoneNo" SortExpression="PhoneNo" />
                        <asp:BoundField DataField="BankAccNo" HeaderText="BankAccNo" SortExpression="BankAccNo" />
                        <asp:BoundField DataField="DutiesID" HeaderText="DutiesID" SortExpression="DutiesID" />
                    </Columns>
                    <FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
                    <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
                    <PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" />
                    <RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
                    <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
                    <SortedAscendingCellStyle BackColor="#FDF5AC" />
                    <SortedAscendingHeaderStyle BackColor="#4D0000" />
                    <SortedDescendingCellStyle BackColor="#FCF6C0" />
                    <SortedDescendingHeaderStyle BackColor="#820000" />
                </asp:GridView>
                <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="Data Source=USER-MSI\MSSQLSERVER2012;Initial Catalog=DRHotelDB;User ID=sa;Password=imsa" ProviderName="System.Data.SqlClient" SelectCommand="SELECT * FROM [StaffProfile]"></asp:SqlDataSource>
                <br />
            </p>
        </ContentTemplate>
    </asp:UpdatePanel>
    </asp:Content>
